package com.yyfax.account.dao;

import com.yyfax.account.domain.DayChangeResult;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface DayChangeResultDao {

	/**
	 * @mbggenerated
	 */
	int insert(DayChangeResult record);

	/**
	 * 批量插入
	 *
	 * @author liangqm
	 * @param records
	 * @return
	 */
	int insertBatch(@Param("records") List<DayChangeResult> records);

	/**
	 * 分批查询当前日切任务的前一日日切结果
	 * account_info left join account_day_change_result
	 * 大数据量使用id> xxx limit 进行分批查询
	 * 
	 * @author liangqm
	 * @date 2017-09-05 15:38:09
	 * @since v1.0.0
	 * @param state
	 * @param queryId 分批查询起始id account_info.id > queryId
	 * @param batchSize 每批查询数量 limit batchSize
	 * @param preDate 当前日切任务前一日的日期 account_info left join account_day_change_result.change_day =preDate
	 * @param currentDate 当前任务的日期 account_info.create_time < currentDate
	 * @return
	 */
	List<DayChangeResult> batchQueryPreDayChangeResult(@Param("queryId") Long queryId, @Param("batchSize") Integer batchSize,
													   @Param("preDate") String preDate, @Param("currentDate") String currentDate);

	/**
	 * 查询当前日切任务前一天日切结果，排除当前日切任务已经入库的数据
	 * account_info
	 * left join account_day_change_result pre ON pre.change_day =preDate
	 * left join account_day_change_result current ON current.change_day =currentDate
	 * WHERE ISNULL(current.id)
	 *
	 * @author maojian
	 * @date 2017-09-05 15:38:09
	 * @since v1.0.0
	 * @param queryId 分批查询起始id account_info.id > queryId
	 * @param batchSize 每批查询数量 limit batchSize
	 * @param preDate 当前日切任务前一日日期
	 * @param currentDate 当前日切任务日期 account_info.create_time < currentDate
	 * @return
	 */
	List<DayChangeResult> batchQueryPreDayChangeResultExcludeExist(@Param("queryId") Long queryId, @Param("batchSize") Integer batchSize,
																   @Param("preDate") String preDate, @Param("currentDate") String currentDate);
}
